//用户相关接口
import request from '@/utils/request'
import type { ResponseData } from 'dto/globalDto.ts'
import type {
  loginInDto,
  LoginOutDto,
  UserInfoDto,
} from 'dto/login/loginDto.ts'

//统一管理接口
enum API {
  LOGIN_URL = '/user/login',
  USERINFO_URL = '/user/info',
}

/**
 * 登录
 * @param data 账号和密码
 * @returns token
 */
export const reqLogin = (data: loginInDto) =>
  request.post<any, ResponseData<LoginOutDto>>(API.LOGIN_URL, data)

/**
 * 当前用户信息
 * @param
 * @returns 类型：UserInfoDto
 */
export const getUserInfo = () =>
  request.get<any, ResponseData<UserInfoDto>>(API.USERINFO_URL)
